#!/bin/bash
RUNS=3
STARTVAL=1000
ITER=$STARTVAL
COUNTER=0
OUTPUT="output.dat"

	if test -f makefile 
	then
		make
		echo "#Iterations Runtime Result" > $OUTPUT
		while [ $COUNTER -lt $RUNS ]
		  do
			echo Run $COUNTER. Calculate Pi with $ITER iterations
			./exercise2_2 $ITER  >> $OUTPUT
			ITER=$(($ITER * 10))
			COUNTER=$(($COUNTER + 1))
		done
	else
		echo "Can not full fill task. 'exercise2_2.c' is missing."
	fi
